<?php
	$MaBV = $_GET['mbv'];
	
	// Xử lý lấy dữ liệu
	$sql = "SELECT * FROM baiviet B, loaichuyenmuc C WHERE B.MaLoaiChuyenMuc = C.MaLoaiChuyenMuc AND MaBaiViet = $MaBV";
	$sqlluotxem = "UPDATE baiviet set LuotXem = LuotXem + 1 where MaBaiViet = $MaBV";
    mysql_query($sqlluotxem);
	$baiviet = mysql_query($sql);
	$dong = mysql_fetch_array($baiviet);
	$mlcm = $dong['MaLoaiChuyenMuc'];
    
?>

<h3 class="shadowntext" id="TieuDeBaiViet"  style="text-align:center;line-height:150%;"><?php echo $dong['TieuDe']; ?></h3>

<table class="NoBorder" border="0" width="700px">
	<tr>
		<td style="font-style:italic;">Ngày đăng: <?php echo $dong['NgayDang']; ?></td>
	</tr>
	<tr>
		<?php echo "<td class='LuotXem'>Lượt xem: {$dong['LuotXem']}</td>"; ?>
	</tr>
	<tr>
		<td style="color:red">
			<strong>Thuộc chủ đề: <?php echo $dong['TenLoaiChuyenMuc']; ?></strong>
		</td>
	</tr>
	<tr>
		<td align="right">
        
			<!-- AddThis Button BEGIN -->
			<div class="addthis_toolbox addthis_default_style ">              
                <script>var pfHeaderImgUrl = '';var pfHeaderTagline = '';var pfdisableClickToDel = 0;var pfDisablePDF = 0;var pfDisableEmail = 0;var pfDisablePrint = 0;var pfCustomCSS = '';var pfBtVersion='1';(function(){var js, pf;pf = document.createElement('script');pf.type = 'text/javascript';if('https:' == document.location.protocol){js='https://pf-cdn.printfriendly.com/ssl/main.js'}else{js='http://cdn.printfriendly.com/printfriendly.js'}pf.src=js;document.getElementsByTagName('head')[0].appendChild(pf)})();</script><a href="http://www.printfriendly.com" style="color:#6D9F00;text-decoration:none;" class="printfriendly" onclick="window.print();return false;" title="Printer Friendly and PDF"><img style="border:none;" src="http://cdn.printfriendly.com/pf-button-both.gif" alt="In, PDF và Email"/></a>
			</div>
			<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
			<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-50a43f1133b63c0a"></script>
			<!-- AddThis Button END -->           
		</td>
	</tr>
	<tr>
		<td id="TomTatBaiViet">
		<?php echo $dong['TomTat']; ?>
		</td>
	</tr>
	<tr>
		<td style="text-align: justify;" id="NoiDungBaiViet"> <?php echo $dong['NoiDung']; ?></td>
	</tr>
	<tr>
		<td class='trolai'> <a href="javascript: history.go(-1)">Quay lại trang trước</a></td>
	</tr>
	
	<tr>	
		<td class='baivietlienquan'>
		<br/>
		<h3 class="shadowntext"> Bài viết liên quan:</h3>
		<?php
			$sqlbvlq = "SELECT * FROM baiviet where MaBaiViet <> $MaBV and MaLoaiChuyenMuc = $mlcm order by NgayDang limit 0,3 ";
			$baivietlq = mysql_query($sqlbvlq);
			while($dongbvlq = mysql_fetch_array($baivietlq))
			{
				echo "<img src='adm/images/li.png'>&nbsp";
				echo " <a href='news.php?do=baivietchitiet&mbv={$dongbvlq['MaBaiViet']}'>{$dongbvlq['TieuDe']}</a> <br />";
			}
		?>
		</td>
	</tr>
</table>

<script type="text/javascript">
function InTrang()
{ 
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
  var content_vlue = document.getElementById("TieuDeBaiViet").innerHTML +"<br/>"+document.getElementById("TomTatBaiViet").innerHTML+"<br/>"+ document.getElementById("NoiDungBaiViet").innerHTML; 
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<html><head><title>Quỹ tín dụng Nhân Dân Mỹ Hòa</title>'); 
   docprint.document.write('</head><body onLoad="self.print()"><center>');          
   docprint.document.write(content_vlue);          
   docprint.document.write('</center></body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
}
</script>
	